package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.Orders;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ReportMapper {
    @Select("SELECT SUM(amount) FROM orders WHERE status = #{completed} AND order_time >= #{begin} AND order_time <= #{end}")
    Double sumamount(@Param("begin") LocalDateTime begin, @Param("end") LocalDateTime end, @Param("completed") int completed);

    Integer ordernumbyerverday(@Param("begin") LocalDateTime begin,@Param("end") LocalDateTime end,@Param("status") Integer status);

    Integer countorder(Integer status);

    List<GoodsSalesDTO> gettop10(@Param("begin") LocalDateTime begin, @Param("end") LocalDateTime end, @Param("status") Integer status);
}

